{% extends "admin/change_list.html" %}
{% load adminmedia admin_list i18n miramar_tags %}

{% block extrastyle %}
  {{ block.super }}
  <link rel="stylesheet" type="text/css" href="{% admin_media_prefix %}css/changelists.css" />
  {% if cl.formset %}
    <link rel="stylesheet" type="text/css" href="{% admin_media_prefix %}css/forms.css" />
    <script type="text/javascript" src="../../jsi18n/"></script>
  {% endif %}
  {{ media }}
  <script type="text/javascript">
    $(document).ready(function() {
    	$('#id_a_addlink').click(function() {
    	    $.modal('<iframe src="{% url admin:miramar_page_slugentry %}" height="200" width="300" style="border: 0">', {
                    containerCss: {
                        height: 200,
                        width: 300,
                        padding: 0
                    },
                    focus: true,
                    overlayClose: true
    	    });
        });
        $('div.module').addClass('filtered');
    });
  </script>
  {% if not actions_on_top and not actions_on_bottom %}
    <style>
      #changelist table thead th:first-child {width: inherit}
    </style>
  {% endif %}
<style type="text/css">
#simplemodal-overlay {
  background-color:#000000;  
  opacity:0.5;  
  filter:alpha(opacity=50);  
  -moz-opacity:0.5;
}
</style>{% endblock %}

{% block object-tools %}
    {% if has_add_permission %}
    <ul class="object-tools">
        <li>
            <a href="#" class="addlink" id="id_a_addlink">
                {% blocktrans with cl.opts.verbose_name as name %}Add {{ name }}{% endblocktrans %}
            </a>
        </li>
    </ul>
    {% endif %}
{% endblock %}
{% block filters %}
    <div id="changelist-filter">
      <h2>{% trans "Workflow" %}</h2>
      {% if user|has_perm:"miramar.can_publish_pageversion" %}
      <h3>{% trans "Approved, not published" %}</h3>
      <ul>
        {% for page_obj in ready_to_publish %}
        <li><a href="{% url miramar_page_update page_obj.slug %}">{{ page_obj.slug }}</a></li>
        {% empty %}
        <li><em>{% trans "No pages to publish" %}</em></li>
        {% endfor %}
      </ul>
      {% endif %}
      
      {% if user|has_perm:"miramar.can_revise_pageversion" %}
      <h3>{% trans "Your recent work" %}</h3>      
      <ul>
        {% for page_obj in recent_work %}
        <li><a href="{% url miramar_page_update page_obj.slug %}">{{ page_obj.slug }}</a></li>
        {% empty %}
        <li><em>{% trans "No recent edits" %}</em></li>
        {% endfor %}
      </ul>
      {% endif %}      

      <h3>{% trans "Most stale pages" %}</h3>
      <ul>
        {% for page_obj in most_stale %}
        <li><a href="{% url miramar_page_update page_obj.slug %}">{{ page_obj.slug }}</a></li>
        {% empty %}
        <li><em>{% trans "No stale pages" %}</em></li>
        {% endfor %}
      </ul>

      {% if user|has_perm:"miramar.can_revise_pageversion" %}
      <h3>{% trans "Recently updated" %}</h3>      
      <ul>
        {% for page_obj in recently_updated %}
        <li><a href="{% url miramar_page_update page_obj.slug %}">{{ page_obj.slug }}</a></li>
        {% empty %}
        <li><em>{% trans "No recent updates" %}</em></li>
        {% endfor %}
      </ul>
      {% endif %}      

    </div>
{% endblock %}